/*
  Example 22.1
  Measuring range of analogRead() using a 1.8V AREF voltage
  tronixstuff.com/tutorials
  CC by-sa-nc
*/

int analoginput = 0; // our analog pin
int analogamount = 0; // stores incoming value
float percentage = 0; // used to store our percentage value
float voltage =0; // used to store voltage value

void setup()
{
  Serial.begin(9600);
  analogReference(EXTERNAL);
} 
  void loop()
{
  delay(200);
  analogamount=analogRead(analoginput);
  percentage=(analogamount/1024)*100;
  voltage=analogamount*1.75; // in millivolts
  Serial.print("Percentage of AREF: ");
  Serial.println(percentage,2);
  Serial.print("voltage on analog input (mV): ");
  Serial.println(voltage,2);
}
  
  
